home *** CD-ROM | disk | FTP | other *** search
- Path: news.worldlinx.com!stupy
- From: stupy@freenet.durham.org (Steve Tupy)
- Newsgroups: comp.lang.c
- Subject: Re: What is '?' in C mean....?????
- Date: 10 Jan 1996 07:16:29 GMT
- Organization: Durham Free-Net
- Message-ID: <4cvp4d$b6u@news.worldlinx.com>
- References: <4cgsa8$bm2@wumpus.cc.uow.edu.au>
- NNTP-Posting-Host: freenet.durham.org
- X-Newsreader: TIN [version 1.2 PL2]
-
- PAOPENG THEERADECH (tp86@wumpus.cc.uow.edu.au) wrote:
- : Hello to all.
- : I got something here to ask you guys. I saw some symbol like "?" be
- : used in some codes. I don't understand what does it mean. I tried to read some
- : text books but I still cannot find the detail about "?". The codes that I saw
- : are;
- : max = x>y ? x:y;
- :
- : and
-
- : printf("%d", x>y ? x:y);
-
- It tells you that an evaluation is about to happen. If x>y then max = x, if
- x>y == 0 then max = y. The first value left of the colon is applied only if
- it evaluates to 1, else the right side is applied.
-
- Cryptic, but it should help you out...
-
- Take care!
-
- --
- Steve
-